#ifndef _MOTOR_H_  
#define _MOTOR_H_  
#include <errno.h>
#include <unistd.h>
#include <sys/types.h>
#include <string.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdio.h>
#include <wiringPi.h>
#include <softPwm.h>
#include <math.h>
#include <pthread.h>
#include <stdlib.h>
#include <string.h>
#include <wiringSerial.h>
#include "ops.h"
//FL左上轮子,FR右上轮子,BR右下轮子,BL左下轮子
#define PWM1 2				//FL
#define MOTOR1 5
#define MOTOR2 7
#define PWM2 3				//FR
#define MOTOR3 6
#define MOTOR4 22
#define PWM3 29				//BR
#define MOTOR5 28
#define MOTOR6 27
#define PWM4  23			//BL
#define MOTOR7 26
#define MOTOR8 25
#define pi 3.1415926
#define dir_x 0
#define dir_y 1
#define s2 0
#define s3 1
#define out 14
#define interval 100
#define motor_a 8
#define motor_b 9
#define LED 11
extern char rgb[],str,zhuan_flag;
extern char pid_busy;
extern int pid_flag;
pthread_t t_color,t_fang;
char buff[255];
extern unsigned char ABCD[];
FILE *p; 
int c;
float Vx;					//速度分解后X方向的分量
float Vy;					//速度分解后Y方向的分量
float S;
float C;
extern int FL,FR,BL,BR;
float aa;

float PID_OUT_angle;
unsigned char cam_adjust;
extern float PID_OUT_pos;
extern int num_x,num_y,end,fd_1,fd_3;
extern int color_max;
extern float target_xx,target_yy;
extern void motor_control(double ang,int V);
extern int VV;
extern void front();
extern void back();
extern void left();
extern void right();
extern void stop();
extern void move_x_y(char dir,float target,int speed,char lo);
void move_x_y_xiang(char dir,float target,int speed ,char fg);
extern void shibie();
extern void shibie2();
extern void duoji_init();
extern int turn_angle(int x);
extern void jixiebi_down();
extern void jixiebi_down2();
extern void jixiebi_up();
void motor_init();
extern void move_1();
extern void move_2();
extern void move_3();
extern void move_4();
extern void stop_1();
extern void stop_2();
extern void stop_3();
extern void stop_4();
extern void zhua();
extern void fang();
extern void laba();
extern void turn_wheel_y();
extern void turn_wheel_x();
void *jiema(void *args);
void jiema_init();
void color_init();
extern void set_angle(unsigned char ID,int agl,unsigned int tim);
extern char tuoluoyi_init(int flag);
void motor_control(double ang,int V);
void color_init();
char zhuan_color(char x);
void erweima_init();
void get_pix();
void find_ring();
char read_erweima();
void *color(void *args);
void *fan(void *args);
void fang_init();
void zhuan();
void turn();
void set_angle(unsigned char ID,int agl,unsigned int tim);
#endif 
